<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ include file="../common/htmlHeader.jsp"%>
<link href="../resources/css/temporary/postShow.css" rel="stylesheet"/>
<title>Insert title here</title>
</head>
<body>
	<span>期望地点</span>
	<!--<input type="text" name="regionId" id="regionId" hidden readonly/>-->
	<ul id="hopeRegionUL">
		<li style="float:left;list-style-type: none;">滦县</li>
		<li style="float:left;list-style-type: none;">1</li>
		<li style="float:left;list-style-type: none;">1</li>
		<li style="float:left;list-style-type: none;">1</li>
	</ul>
	<br />
	<div id="regionDiv">
		<select name="province" id="province" onchange="loadSonRegion(this)">
			<option value="0">请选择省份</option>
			<c:forEach items="${prList}" var="item">
				<option value="${item.provinceId }">${item.province }</option>
			</c:forEach>
		</select>
		<select name="city" id="city" onchange="loadSonRegion(this)">
			<option value="0">请选择市</option>
		</select>
		<select name="county" id="county" onchange="loadSonRegion(this)">
			<option value='0'>请选择区/县</option>
		</select>
	</div>
	<button onclick="addProvince()">确认</button>
	<%@ include file="../common/htmlFooter.jsp"%>
	<script>
		function addProvince(){
			var check=$("select>option:selected[value!=0]:last").size()>0;
			var value=$("select>option:selected[value!=0]:last").val();
			var html=$("select>option:selected[value!=0]:last").html();
			if (check) {
				$("ul#hopeRegionUL").append("<li id="+value+" value="+value+">"+html+"</li>")
			}
		}
		function loadSonRegion(obj){
			var $this=$(obj);
			var regionId=$this.val();
			$.post("../region/getRegionList",{"regionId": regionId},function(data){
				$this.next().empty();
				$this.next().append("<option value='0'>不限</option>")
				for(var i in data.regionList){
					item=data.regionList[i];
					$this.next().append("<option value="+item.regionId+">"+item.region+"</option>")
				}
			},"json")
		}
	</script>
</body>
</html>